﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/AdminDefault.Master"
  AutoEventWireup="true" CodeBehind="ContactPage.aspx.cs" Inherits="NguyenHoa.Web.Admin.ContactPage" %>

<%@ Register Assembly="DevExpress.Web.ASPxHtmlEditor.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxHtmlEditor" TagPrefix="dxhe" %>
<%@ Register Assembly="DevExpress.Web.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dxcb" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register Assembly="DevExpress.Web.ASPxSpellChecker.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxSpellChecker" TagPrefix="dxwsc" %>
<%@ Register Assembly="DevExpress.Web.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxTabControl" TagPrefix="dxtc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  <dxtc:ASPxTabControl ID="tabCtrl" ClientInstanceName="tabCtrl" runat="server" 
    ActiveTabIndex="0">
    <ClientSideEvents ActiveTabChanged="function(s, e) {onTabChange(s, e);}" />
    <TabStyle Width="55px">
    </TabStyle>
    <Tabs>
      <dxtc:Tab Name="Address" Text="<%$Resources:Strings, ContactInfo %>">
        <TabStyle Cursor="pointer">
        </TabStyle>
      </dxtc:Tab>
      <dxtc:Tab Name="Hotline" Text="<%$Resources:Strings, Hotline %>">
        <TabStyle Cursor="pointer">
        </TabStyle>
      </dxtc:Tab>
      <dxtc:Tab Name="Online" Text="<%$Resources:Strings, OnlineSupport %>">
        <TabStyle Cursor="pointer">
        </TabStyle>
      </dxtc:Tab>
      <dxtc:Tab Name="Map" Text="<%$Resources:Strings, ViewMap %>">
        <TabStyle Cursor="pointer">
        </TabStyle>
      </dxtc:Tab>
    </Tabs>
  </dxtc:ASPxTabControl>
  <div id="divAddress">
    <div style="float: left; padding: 20px 0 0 3px;" class="CommonFont">
      <asp:Label ID="Label1" runat="server" Text="<%$Resources:Strings, Type %>"></asp:Label>
      :
    </div>
    <div style="float: left; padding: 20px 0 0 10px;">
      <dxe:ASPxComboBox ID="cbxType" runat="server" ClientInstanceName="cbxType"
        ValueType="System.String">
        <Items>
          <dxe:ListEditItem Text="<%$Resources:Strings, ContactAddress %>" Value="A" />
          <dxe:ListEditItem Text="<%$Resources:Strings, TransferInfo %>" Value="T" />
          <dxe:ListEditItem Text="<%$Resources:Strings, ContactInfo %>" Value="C" />
        </Items>
        <ButtonStyle Width="13px">
        </ButtonStyle>
        <ValidationSettings>
          <ErrorImage Width="14px" />
        </ValidationSettings>
        <ClientSideEvents ValueChanged="function(s,e){oncbxLanguage_ValueChanged(s,e);}" />
      </dxe:ASPxComboBox>
    </div>
    <div style="float: left; padding: 20px 0 0 20px;" class="CommonFont">
      <asp:Label ID="Label2" runat="server" Text="<%$Resources:Strings, Language %>"></asp:Label>
      :
    </div>
    <div style="float: left; padding: 20px 0 0 10px;">
      <dxe:ASPxComboBox ID="cbxLanguage" runat="server" ClientInstanceName="cbxLanguage"
        DataSourceID="xdsLanguage" TextField="Value"
        ValueField="Id" ValueType="System.Int32">
        <ButtonStyle Width="13px">
        </ButtonStyle>
        <ValidationSettings>
          <ErrorImage Width="14px" />
        </ValidationSettings>
        <ClientSideEvents ValueChanged="function(s,e){oncbxLanguage_ValueChanged(s,e);}" />
      </dxe:ASPxComboBox>
    </div>
    <div style="clear: both; padding-top: 10px;">
      <dxhe:ASPxHtmlEditor ID="htmlEditor" runat="server" ClientInstanceName="htmlEditor">
        <SettingsImageUpload>
          <ValidationSettings AllowedContentTypes="image/jpeg,image/pjpeg,image/gif,image/png,image/x-png">
          </ValidationSettings>
        </SettingsImageUpload>
        <Images>
          <DialogFormCloseButton Width="17px" />
        </Images>
        <PartsRoundPanel>
          <TopLeftCorner
            Width="5px" />
          <NoHeaderTopLeftCorner
            Width="5px" />
          <TopRightCorner
            Width="5px" />
          <NoHeaderTopRightCorner
            Width="5px" />
          <BottomRightCorner
            Width="5px" />
          <BottomLeftCorner
            Width="5px" />
        </PartsRoundPanel>
      </dxhe:ASPxHtmlEditor>
    </div>
    <div style="padding-top: 10px;">
      <dxe:ASPxButton ID="btnSave" ClientInstanceName="btnSave" runat="server" Text="<%$ Resources:Strings, Save %>"
        AutoPostBack="False">
        <ClientSideEvents Click="function(s,e){onSave();}" />
      </dxe:ASPxButton>
    </div>
  </div>
  <div style="padding-top: 20px; clear: both; display: none;" id="divHotline">
    <dxwgv:ASPxGridView ID="gvHotline" ClientInstanceName="gvHotline" runat="server"
      AutoGenerateColumns="False" KeyFieldName="Id" Width="400px" OnCustomCallback="gvHotline_CustomCallback"
      OnCustomJSProperties="gvHotline_CustomJSProperties" OnRowDeleting="gvHotline_RowDeleting"
      OnRowInserting="gvHotline_RowInserting" OnRowUpdating="gvHotline_RowUpdating">
      <SettingsBehavior ConfirmDelete="True" AllowDragDrop="false" AllowSort="false" />
      <Images>
        <CollapsedButton Width="11px" />
        <DetailCollapsedButton Width="9px" />
        <HeaderFilter
          Width="18px" />
        <HeaderActiveFilter
          Width="18px" />
        <FilterRowButton Width="13px" />
        <CustomizationWindowClose Width="17px" />
        <PopupEditFormWindowClose Width="17px" />
        <FilterBuilderClose Width="17px" />
      </Images>
      <SettingsEditing Mode="Inline" NewItemRowPosition="Bottom" />
      <SettingsText ConfirmDelete="<%$Resources:Messages,ERR0006 %>" />
      <Columns>
        <dxwgv:GridViewCommandColumn ButtonType="Image" VisibleIndex="0" Width="60px" 
          Caption=" ">
          <DeleteButton Visible="True">
            <Image Url="~/images/delete.png" />
          </DeleteButton>
          <EditButton Visible="True">
            <Image Url="~/images/edit.png" />
          </EditButton>
          <NewButton Visible="True">
            <Image Url="~/images/add.png" />
          </NewButton>
          <CancelButton>
            <Image Url="~/images/undo.gif" />
          </CancelButton>
          <UpdateButton>
            <Image Url="~/images/save.png" />
          </UpdateButton>
          <HeaderStyle HorizontalAlign="Center" />
          <CellStyle Cursor="pointer">
          </CellStyle>
        </dxwgv:GridViewCommandColumn>
        <dxwgv:GridViewDataTextColumn FieldName="Value" VisibleIndex="2" Caption="<%$Resources:Strings, Phone %>"
          Width="200px">
          <HeaderStyle HorizontalAlign="Center" />
          <CellStyle HorizontalAlign="Left">
          </CellStyle>
        </dxwgv:GridViewDataTextColumn>
      </Columns>
      <SettingsPager>
        <Summary AllPagesText="<%$Resources:Strings, PagerText %>" Text="<%$Resources:Strings, PagerText %>" />
      </SettingsPager>
      <ClientSideEvents EndCallback="function(s,e){ongvHotline_EndCallback(s,e);}" />
    </dxwgv:ASPxGridView>
  </div>
  <div style="padding-top: 20px; clear: both; display: none;" id="divOnlineSupport">
    <dxwgv:ASPxGridView ID="gvOnline" ClientInstanceName="gvOnline" runat="server" AutoGenerateColumns="False"
      KeyFieldName="Id" Width="600px" OnCustomCallback="gvOnline_CustomCallback" OnCustomJSProperties="gvOnline_CustomJSProperties"
      OnRowDeleting="gvOnline_RowDeleting" OnRowInserting="gvOnline_RowInserting" OnRowUpdating="gvOnline_RowUpdating"
      OnCellEditorInitialize="gvOnline_CellEditorInitialize">
      <SettingsBehavior ConfirmDelete="True" AllowDragDrop="false" AllowSort="false" />
      <Images>
        <CollapsedButton Width="11px" />
        <DetailCollapsedButton Width="9px" />
        <HeaderFilter
          Width="18px" />
        <HeaderActiveFilter
          Width="18px" />
        <FilterRowButton Width="13px" />
        <CustomizationWindowClose Width="17px" />
        <PopupEditFormWindowClose Width="17px" />
        <FilterBuilderClose Width="17px" />
      </Images>
      <SettingsEditing Mode="Inline" NewItemRowPosition="Bottom" />
      <SettingsText ConfirmDelete="<%$Resources:Messages,ERR0006 %>" />
      <Columns>
        <dxwgv:GridViewCommandColumn ButtonType="Image" VisibleIndex="0" Width="60px" 
          Caption=" ">
          <DeleteButton Visible="True">
            <Image Url="~/images/delete.png" />
          </DeleteButton>
          <EditButton Visible="True">
            <Image Url="~/images/edit.png" />
          </EditButton>
          <NewButton Visible="True">
            <Image Url="~/images/add.png" />
          </NewButton>
          <CancelButton>
            <Image Url="~/images/undo.gif" />
          </CancelButton>
          <UpdateButton>
            <Image Url="~/images/save.png" />
          </UpdateButton>
          <HeaderStyle HorizontalAlign="Center" />
          <CellStyle Cursor="pointer">
          </CellStyle>
        </dxwgv:GridViewCommandColumn>
        <dxwgv:GridViewDataTextColumn FieldName="Name" VisibleIndex="1">
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewDataTextColumn Caption="<%$ Resources:Strings, ChattingNick %>" FieldName="Value"
          VisibleIndex="2">
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewDataComboBoxColumn FieldName="Type" VisibleIndex="3" Caption="<%$Resources:Strings, Type %>">
          <PropertiesComboBox DataSourceID="xdsType" TextField="Value" ValueField="Id" ValueType="System.String">
          </PropertiesComboBox>
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataComboBoxColumn>
        <dxwgv:GridViewDataComboBoxColumn FieldName="Activity" VisibleIndex="4" Caption="<%$ Resources:Strings, Activity %>">
          <PropertiesComboBox DataSourceID="xdsActivity" TextField="Value" ValueField="Id"
            ValueType="System.String">
          </PropertiesComboBox>
          <HeaderStyle HorizontalAlign="Center" />
        </dxwgv:GridViewDataComboBoxColumn>
      </Columns>
      <SettingsPager>
        <Summary AllPagesText="<%$Resources:Strings, PagerText %>" Text="<%$Resources:Strings, PagerText %>" />
      </SettingsPager>
      <ClientSideEvents EndCallback="function(s,e){ongvOnline_EndCallback(s,e);}" />
    </dxwgv:ASPxGridView>
  </div>
  <div style="padding-top: 20px; clear: both; display: none;" id="divMap">
    <dxwgv:ASPxGridView ID="gvMap" ClientInstanceName="gvMap" runat="server"
      AutoGenerateColumns="False" KeyFieldName="Id" Width="400px" OnCustomCallback="gvMap_CustomCallback"
      OnCustomJSProperties="gvMap_CustomJSProperties" OnRowDeleting="gvMap_RowDeleting"
      OnRowInserting="gvMap_RowInserting" OnRowUpdating="gvMap_RowUpdating">
      <SettingsBehavior ConfirmDelete="True" AllowDragDrop="false" AllowSort="false" />
      <Images>
        <CollapsedButton Width="11px" />
        <DetailCollapsedButton Width="9px" />
        <HeaderFilter
          Width="18px" />
        <HeaderActiveFilter
          Width="18px" />
        <FilterRowButton Width="13px" />
        <CustomizationWindowClose Width="17px" />
        <PopupEditFormWindowClose Width="17px" />
        <FilterBuilderClose Width="17px" />
      </Images>
      <SettingsEditing Mode="Inline" NewItemRowPosition="Bottom" />
      <SettingsText ConfirmDelete="<%$Resources:Messages,ERR0006 %>" />
      <Columns>
        <dxwgv:GridViewCommandColumn ButtonType="Image" VisibleIndex="0" Width="60px" 
          Caption=" ">
          <DeleteButton Visible="True">
            <Image Url="~/images/delete.png" />
          </DeleteButton>
          <EditButton Visible="True">
            <Image Url="~/images/edit.png" />
          </EditButton>
          <NewButton Visible="True">
            <Image Url="~/images/add.png" />
          </NewButton>
          <CancelButton>
            <Image Url="~/images/undo.gif" />
          </CancelButton>
          <UpdateButton>
            <Image Url="~/images/save.png" />
          </UpdateButton>
          <HeaderStyle HorizontalAlign="Center" />
          <CellStyle Cursor="pointer">
          </CellStyle>
        </dxwgv:GridViewCommandColumn>
        <dxwgv:GridViewDataTextColumn FieldName="Value" VisibleIndex="2" Caption="<%$Resources:Strings, ReferenceLink %>"
          Width="200px">
          <HeaderStyle HorizontalAlign="Center" />
          <CellStyle HorizontalAlign="Left">
          </CellStyle>
        </dxwgv:GridViewDataTextColumn>
      </Columns>
      <SettingsPager>
        <Summary AllPagesText="<%$Resources:Strings, PagerText %>" Text="<%$Resources:Strings, PagerText %>" />
      </SettingsPager>
      <ClientSideEvents EndCallback="function(s,e){ongvMap_EndCallback(s,e);}" />
    </dxwgv:ASPxGridView>
  </div>
  <dxcb:ASPxCallback ID="ctrlCallback" ClientInstanceName="ctrlCallback" runat="server"
    OnCallback="ctrlCallback_Callback">
    <ClientSideEvents CallbackComplete="function(s,e){onctrlCallback_CallbackComplete(s,e);}" />
  </dxcb:ASPxCallback>
  <asp:XmlDataSource ID="xdsLanguage" runat="server" DataFile="~/App_Data/Status.xml"
    XPath="Items/LanguageDisplay/Status"></asp:XmlDataSource>
  <asp:XmlDataSource ID="xdsType" runat="server" DataFile="~/App_Data/Status.xml" XPath="Items/OnlineType/Type">
  </asp:XmlDataSource>
  <asp:XmlDataSource ID="xdsActivity" runat="server" DataFile="~/App_Data/Status.xml"
    XPath="Items/OnlineActivity/Type"></asp:XmlDataSource>

  <script type="text/javascript" language="javascript">
    function onctrlCallback_CallbackComplete(s, e) {
      var error = e.result;
      if (error != '') {
        if (error.indexOf('HTML') >= 0) {
          var para = error.split('|');
          htmlEditor.SetHtml(para[1]);
        }
        else
          alertMessage(error);
      }
      else {
        alertSuccess();
      }
    }

    function ongvHotline_EndCallback(s, e) {
      var error = s.cpInnerError;
      if (error != '') {
        alertMessage(error);
      }
    }

    function ongvOnline_EndCallback(s, e) {
      var error = s.cpInnerError;
      if (error != '')
        alertMessage(error);
    }
    
    function ongvMap_EndCallback(s, e) {
      var error = s.cpInnerError;
      if (error != '') {
        alertMessage(error);
      }
    }

    function oncbxLanguage_ValueChanged(s, e) {
      ctrlCallback.PerformCallback('ChangeLang|');
    }

    function onSave() {
      ctrlCallback.PerformCallback('Save|');
    }

    function onTabChange(s, e) {
      var activeTab = s.GetActiveTab().name;
      var divAddress = document.getElementById('divAddress');
      var divHotline = document.getElementById('divHotline');
      var divOnlineSupport = document.getElementById('divOnlineSupport');
      var divMap = document.getElementById('divMap');
      if (activeTab == 'Address') {
        divAddress.style.display = 'block';
        divHotline.style.display = 'none';
        divOnlineSupport.style.display = 'none';
        divMap.style.display = 'none';
      }
      else if (activeTab == 'Hotline') {
        divAddress.style.display = 'none';
        divHotline.style.display = 'block';
        divOnlineSupport.style.display = 'none';
        divMap.style.display = 'none';
      }
      else if (activeTab == 'Online') {
        divAddress.style.display = 'none';
        divHotline.style.display = 'none';
        divOnlineSupport.style.display = 'block';
        divMap.style.display = 'none';
      }
      else if (activeTab == 'Map') {
        divAddress.style.display = 'none';
        divHotline.style.display = 'none';
        divOnlineSupport.style.display = 'none';
        divMap.style.display = 'block';
      }
    }
  
  </script>

</asp:Content>
